package logic

import (
	"context"
	"huiyun/model/mysql"

	"huiyun/huiyunrpc/huiyunrpc"
	"huiyun/huiyunrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ReplyAddLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewReplyAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ReplyAddLogic {
	return &ReplyAddLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 活动回复
func (l *ReplyAddLogic) ReplyAdd(in *huiyunrpc.ReplyAddRequest) (*huiyunrpc.ReplyAddResponse, error) {
	// todo: add your logic here and delete this line
	reply := mysql.Reply{
		SportId: in.SportId,
		UserId:  in.UserId,
		Content: in.Content,
	}
	mysql.DB.Debug().Create(&reply)
	return &huiyunrpc.ReplyAddResponse{
		ReplyId: int64(reply.ID),
	}, nil
}
